<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <base href="${request.contextPath}/"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!--    <title>互联网+农业云</title>-->
    <#import "/spring.ftl" as spring>
    <title><@spring.message code="index.top"/></title>
    <script src="${request.contextPath}/js/jquery-1.11.1.min.js"></script>
    <script src="${request.contextPath}/js/echarts.min.js"></script>
    <script src="${request.contextPath}/js/common_click.js"></script>
    <link rel="stylesheet" href="${request.contextPath}/css/common.css">
    <link rel="stylesheet" href="${request.contextPath}/css/nydsj.css">
    <style>
        .content_img_postion {
            width: 140px;
            height: 20px;
            position: absolute;


        }

        .content_img_postion img {
            width: 20px;
            float: left;
        }
        .position_text{
            float: left;
            width: 120px;
            text-indent: 5px;
            font-weight: 800;
            color: red;
            font-size: 16px;
        }
        /*.position_suibin {*/
            /*background-color: yellow;*/
            /*!*display: none;*!*/
        /*}*/

        /*.position_qitaihe {*/
            /*background-color: #0ED844;*/
            /*!*display: none;*!*/
        /*}*/

        /*.position_luobei {*/
            /*background-color: #1E9FFF;*/
            /*!*display: none;*!*/
        /*}*/

        /*.position_sunwu {*/
            /*background-color: #00F7DE;*/
            /*!*display: none;*!*/
        /*}*/

        /*.position_raohe {*/
            /*background-color: #91A2BF;*/
            /*!*display: none;*!*/
        /*}*/


    </style>

</head>
<body>
<div class="top_all">
<!--    <p class="top_title">互联网+农业云</p>-->
    <p class="top_title"><@spring.message code="index.top"/></p>
    <div class="top_user">
        <div class="user_user">
            <#if isAdmn == "TRUE">
            <div class="top_user_img">
                <img src="${request.contextPath}/images/timg.png" alt="">

            </div>

            <a href="javascript:;" onclick="shouye()">
<!--                  <p class="top_user_name">首页</p>-->
                  <p class="top_user_name"><@spring.message code="index.page"/></p>
            </a>
            </#if>
        </div>

    </div>


    <div class="top_out">
        <div class="out_out">
            <div class="top_out_img">
                <img src="${request.contextPath}/images/icon.png" alt="">

            </div>
            <a href="${request.contextPath}/sy/logout">
<!--                <p class="top_out_name">退出</p>-->
                <p class="top_out_name"><@spring.message code="index.out"/></p>
            </a>
        </div>

    </div>


</div>

<!--图表-->
<div class="content_all">

    <div class="left_all">
        <div class="left_one">
<!--            <p class="left_one_title">粮食价格</p>-->
            <p class="left_one_title"><@spring.message code="nydsj.lsjg"/></p>
            <div class="left_one_echarts">
                <div id="main" style="width: 100%;height:100%;"></div>
                <script type="text/javascript">
                    if (screen.width > 1919)
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_lsjg_1920.js"><\/script>');
                    if (screen.width < 1919) {
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_lsjg_1440.js"><\/script>');
                    }
                </script>
            </div>
        </div>
        <div class="left_two two">
<!--            <p class="left_one_title">水稻产量</p>-->
            <p class="left_one_title"><@spring.message code="nydsj.sdcl"/></p>
            <div id="main2" style="width: 100%;height:100%;"></div>
            <script type="text/javascript">
                if (screen.width > 1919)
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_sdcl_1920.js"><\/script>');
                if (screen.width < 1919) {
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_sdcl_1440.js"><\/script>');
                }
            </script>
        </div>
        <div class="left_three two">
<!--            <p class="left_three_title">土壤有机质</p>-->
            <p class="left_three_title"><@spring.message code="nydsj.tryjz"/></p>
            <div id="main3" style="width: 100%;height:100%;"></div>
            <script type="text/javascript">
                if (screen.width > 1919)
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_tryjz_1920.js"><\/script>');
                if (screen.width < 1919) {
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_tryjz_1440.js"><\/script>');
                }
            </script>
        </div>
    </div>

    <div class="center_all">
        <div class="map_all">

            <div class="content_map">
                <img src="${request.contextPath}/images/${address}.jpg" alt="">
            </div>
            <#list lanlist as lands>
                <div  class="content_img_postion position_${address}" style="top:${lands.top!'50%'};left: ${lands.left!'50%'};" onclick="show('${lands.massifId}','${lands.userkey}')">
                    <!--修改完！-->
                    <img src="${request.contextPath}/images/postion_rideo.png" alt="">
                    <p class="position_text"> ${lands.massifName}</p>
                </div>

            </#list>



    </div>

    <div class="content_echarts">
        <div class="content_echarts_one">
<!--            <p class="content_title">土壤PH值</p>-->
            <p class="content_title"><@spring.message code="nydsj.ph"/></p>
            <div id="main4" class="echarts_one"></div>
            <script type="text/javascript">
                if (screen.width > 1919)
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_trphz_1920.js"><\/script>');
                if (screen.width < 1919) {
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_trphz_1440.js"><\/script>');
                }
            </script>
        </div>

        <div class="content_echarts_two">
<!--            <p class="content_title">报警信息</p>-->
            <p class="content_title"><@spring.message code="nydsj.bjxx"/></p>
            <table class="center_table" id="bjxx">

            </table>
        </div>
    </div>
</div>

<div class="right_all">
    <div class="right_one">
        <div class="right_one_1">
<!--            <p class="right_one_1_title">种植面积</p>-->
            <p class="right_one_1_title"><@spring.message code="nydsj.zzmj"/></p>
            <div class="right_one_1_echarts">
                <div class="right_one_1_echarts_table">
                </div>
            </div>
        </div>

        <div class="right_one_2">
<!--            <p class="right_one_2_title">化肥</p>-->
            <p class="right_one_2_title"><@spring.message code="nydsj.hf"/></p>
            <div id="main5" class="right_one_2_echarts">
                <script type="text/javascript">
                    if (screen.width > 1919)
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_hf_1920.js"><\/script>');
                    if (screen.width < 1919) {
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_hf_1440.js"><\/script>');
                    }
                </script>

            </div>
        </div>
    </div>
    <div class="right_one two">
        <div class="right_one_1">
<!--            <p class="right_one_1_title">有效钾</p>-->
            <p class="right_one_1_title"><@spring.message code="nydsj.yxj"/></p>
            <div id="main6" class="right_one_1_echarts">
                <script type="text/javascript">
                    if (screen.width > 1919)
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_yxj_1920.js"><\/script>');
                    if (screen.width < 1919) {
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_yxj_1440.js"><\/script>');
                    }
                </script>
            </div>
        </div>
        <div class="right_one_2">
<!--            <p class="right_one_2_title">有效磷</p>-->
            <p class="right_one_2_title"><@spring.message code="nydsj.yxl"/></p>
            <div id="main7" class="right_one_2_echarts">
                <script type="text/javascript">
                    if (screen.width > 1919)
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_yxl_1920.js"><\/script>');
                    if (screen.width < 1919) {
                        document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_yxl_1440.js"><\/script>');
                    }
                </script>
            </div>
        </div>
    </div>
    <div class="right_one two">

        <div id="main8" class="right_bottom">
            <script type="text/javascript">
                var aa ='<@spring.message code="nydsj.gzqd"/>';
                var bb ='<@spring.message code="nydsj.kqsd"/>';
                var cc ='<@spring.message code="nydsj.trsd"/>';
                var dd ='<@spring.message code="nydsj.jyyl"/>';
                var ee ='<@spring.message code="nydsj.kqzl"/>';
                var mm ='<@spring.message code="nydsj.max"/>';

                if (screen.width > 1919)
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_echarts_1920.js"><\/script>');
                if (screen.width < 1919) {
                    document.write('<script type="text/javascript" src="${request.contextPath}/js/nydsj_echarts_1440.js"><\/script>');
                }
            </script>
        </div>
    </div>
</div>

</div>

<div class="footer_all"></div>


<input id="CS_val" value="${address}" type="hidden">
</body>
</html>
<script src="${request.contextPath}/js/layer/layer.js"></script>


<script>
    window.addeventlistener('load',function(){
        var script=document.createElement('script');
        script.src='url';
        document.getElementsByTagName("body")[0].appendChild(script);

    })

    function shouye(){
        var req = new XMLHttpRequest();
        req.open('GET', document.location, false);
        req.send(null);
        var headers = req.getAllResponseHeaders();
        var local=req.getResponseHeader('content-language');
        //alert(local);
        // $.ajax({
        //     type: 'HEAD', // 获取头信息，type=HEAD即可
        //     url : window.location.href,
        //     //url:"http://device.qq.com/cgi-bin/device_cgi/remote_bind_get_Verify",
        //     complete: function( xhr,data ){
        //         // 获取相关Http Response header
        //         var wpoInfo = {
        //             // 服务器端时间
        //             "date" : xhr.getResponseHeader('Date'),
        //             // 如果开启了gzip，会返回这个东西
        //             "contentEncoding" : xhr.getResponseHeader('Content-Encoding'),
        //             // keep-alive ？ close？
        //             "connection" : xhr.getResponseHeader('Connection'),
        //             // 响应长度
        //             "contentLength" : xhr.getResponseHeader('content-length'),
        //             // 服务器类型，apache？lighttpd？
        //             "server" : xhr.getResponseHeader('Server'),
        //             "vary" : xhr.getResponseHeader('Vary'),
        //             "transferEncoding" : xhr.getResponseHeader('Transfer-Encoding'),
        //             // text/html ? text/xml?
        //             "contentType" : xhr.getResponseHeader('Content-Type'),
        //             "cacheControl" : xhr.getResponseHeader('Cache-Control'),
        //             // 生命周期？
        //             "exprires" : xhr.getResponseHeader('Exprires'),
        //             "lastModified" : xhr.getResponseHeader('Last-Modified')
        //         };
        //         console.log(xhr.getAllResponseHeaders());
        //         console.log(xhr.getResponseHeader('content-language'));
        //     }
        // });
        if(local=="en-US"){
            local="en_US";
        }else{
            local="zh_CN";
        }
        //alert(local+"-----"+"en_US");
       window.location.href="${request.contextPath}/sy/index/index?locale="+local;
    }


</script>

<script>

    $.ajax({
        type: "post",
        dataType: "json",
        url: "sy/nydsj/bjxx",
        success: function (json) {
            var jsonarray = $.parseJSON(json);
            var str = "";
            for (var i = 0; i < jsonarray.length; i++) {
                str += "<tr>" +
                    "<td>" + jsonarray[i].createDate + "</td>>" +
                    "<td>" + jsonarray[i].region + "</td>>" +
                    "<td>" + jsonarray[i].situation + "</td>>" +
                    "<td>" + jsonarray[i].situationValue + "℃</td>>" +
                    "</tr>"
            }
            $("table.center_table").append(str);

        },
        error: function () {
        }
    });

</script>
<script>

    $.ajax({
        type: "post",
        dataType: "json",
        url: "sy/nydsj/zzmj",
        success: function (json) {
            var jsonarray = $.parseJSON(json);
            var atr = "";

            var nums = "";
            var nn = "";
            var bbb = "㎡";
            for (var i = 0; i < jsonarray.length; i++) {
                var str = "";
                nums = jsonarray[i].area;
                for (var j = 0; j < 6; j++) {
                    nn = nums.substring(j, j + 1);
                    str += "<div>" + nn + "</div>"
                }

                atr += "<div class='right_one_1_echarts_tr'>" + "<div class='right_one_1_echarts_tr_td1'>" + jsonarray[i].category + "</div>" + "<div class='right_one_1_echarts_tr_td2'>" + str + "</div>" + "<div class='right_one_1_echarts_tr_td3'>" + bbb + "</div>" + "</div>";

            }
            $(".right_one_1_echarts_table").append(atr);

        },
        error: function () {
        }
    });

</script>

<script>
    // <!--$(function () {-->
    //     <!--var CS = $("#CS_val").val()-->
    //     <!--if (CS == "suibin") {-->
    //         <!--$(".position_suibin").css("display", "block")-->
    //     <!--}-->
    //     <!--if (CS == "qitaihe") {-->
    //         <!--$(".position_qitaihe").css("display", "block")-->
    //     <!--}-->
    //     <!--if (CS == "luobei") {-->
    //         <!--$(".position_luobei").css("display", "block")-->
    //     <!--}-->
    //     <!--if (CS == "sunwu") {-->
    //         <!--$(".position_sunwu").css("display", "block")-->
    //     <!--}-->
    //     <!--if (CS == "raohe") {-->
    //         <!--$(".position_raohe").css("display", "block")-->
    //     <!--}-->
    //
    // <!--})-->
</script>
<script>
    // $(function () {
    //
    //     $(".position_qitaihe").eq(0).css("top", "55%");
    //     $(".position_qitaihe").eq(0).css("left", "27%");
    //     $(".position_qitaihe").eq(0).click(function () {
    //         show("40830373-f86a-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_qitaihe").eq(1).css("top", "31%");
    //     $(".position_qitaihe").eq(1).css("left", "60%");
    //     $(".position_qitaihe").eq(1).click(function () {
    //         show("5d56c776-f78b-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_qitaihe").eq(2).css("top", "25%");
    //     $(".position_qitaihe").eq(2).css("left", "73%");
    //     $(".position_qitaihe").eq(2).click(function () {
    //
    //         show("9e091fab-f82c-11e8-a2fa-5254001a1f4d");
    //     });
    //
    //
    //     $(".position_suibin").eq(0).css("top", "30%");
    //     $(".position_suibin").eq(0).css("left", "75%");
    //     $(".position_suibin").eq(0).click(function () {
    //
    //         show("40830373-f86a-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_suibin").eq(1).css("top", "60%");
    //     $(".position_suibin").eq(1).css("left", "29%");
    //     $(".position_suibin").eq(1).click(function () {
    //
    //         show("5d56c776-f78b-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_suibin").eq(2).css("top", "45%");
    //     $(".position_suibin").eq(2).css("left", "59%");
    //     $(".position_suibin").eq(2).click(function () {
    //
    //         show("9e091fab-f82c-11e8-a2fa-5254001a1f4d");
    //     });
    //
    //     $(".position_luobei").eq(0).css("top", "35%");
    //     $(".position_luobei").eq(0).css("left", "50%");
    //     $(".position_luobei").eq(0).click(function () {
    //
    //         show("40830373-f86a-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_luobei").eq(1).css("top", "20%");
    //     $(".position_luobei").eq(1).css("left", "29%");
    //     $(".position_luobei").eq(1).click(function () {
    //
    //         show("5d56c776-f78b-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_luobei").eq(2).css("top", "65%");
    //     $(".position_luobei").eq(2).css("left", "59%");
    //     $(".position_luobei").eq(2).click(function () {
    //
    //         show("9e091fab-f82c-11e8-a2fa-5254001a1f4d");
    //     });
    //
    //     $(".position_sunwu").eq(0).css("top", "13%");
    //     $(".position_sunwu").eq(0).css("left", "70%");
    //     $(".position_sunwu").eq(0).click(function () {
    //
    //         show("40830373-f86a-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_sunwu").eq(1).css("top", "18%");
    //     $(".position_sunwu").eq(1).css("left", "49%");
    //     $(".position_sunwu").eq(1).click(function () {
    //
    //         show("5d56c776-f78b-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_sunwu").eq(2).css("top", "45%");
    //     $(".position_sunwu").eq(2).css("left", "59%");
    //     $(".position_sunwu").eq(2).click(function () {
    //
    //         show("9e091fab-f82c-11e8-a2fa-5254001a1f4d");
    //     });
    //
    //     $(".position_raohe").eq(0).css("top", "35%");
    //     $(".position_raohe").eq(0).css("left", "59%");
    //     $(".position_raohe").eq(0).click(function () {
    //
    //         show("40830373-f86a-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_raohe").eq(1).css("top", "20%");
    //     $(".position_raohe").eq(1).css("left", "39%");
    //     $(".position_raohe").eq(1).click(function () {
    //
    //         show("5d56c776-f78b-11e8-a2fa-5254001a1f4d");
    //     });
    //     $(".position_raohe").eq(2).css("top", "65%");
    //     $(".position_raohe").eq(2).css("left", "45%");
    //     $(".position_raohe").eq(2).click(function () {
    //
    //         show("9e091fab-f82c-11e8-a2fa-5254001a1f4d");
    //     });
    //
    //     function show(id) {
    //         window.location.href = "${request.contextPath}/sy/wlwjd/wlwjd.html?dkid=" + id;
    //     }
    // })
    function show(id,key) {

        if( key == "404"){
            alert("设备连接异常，请联系管理员检查线路！");
        }else{
             window.location.href = "${request.contextPath}/sy/wlwjd/wlwjd.html?dkid=" + id;
         }
    }
</script>
<script>
    $(function () {


        $(".button_click").eq(0).css({backgroundColor: "#43D3FF"})
        $(".button_click").eq(0).children("a").css({color: "#1921BB"})


    })
</script>
<script>

    var zlzs='<@spring.message code="menu.zlzs"/>';
    var zjwd='<@spring.message code="menu.zjwd"/>';
    var nybk='<@spring.message code="menu.nybk"/>';
    var nydsj='<@spring.message code="menu.nydsj"/>';


</script>